import request from '@/utils/request'
const api_name = '/edu/course'

export default {
    // 添加课程表单接口
    saveCourseInfo(courseInfo) {
        return request({
            url: `${api_name}/saveCourseInfo`,
            method: 'post',
            data: courseInfo
        })
    },
    // 查询所有讲师接口
    getTeacherList() {
        return request({
            url: `/edu/teacher/findAll`,
            method: 'get'
        })
    },
    // 根据课程id查询
    getCourseInfoById(id) {
        return request({
            url: `${api_name}/course-info/${id}`,
            method: 'get'
        })
    },
    // 根据Id 更新课程基本信息
    updateCourseInfoById(courseInfo) {
        return request({
            url: `${api_name}/update-course-info/${courseInfo.id}`,
            method: 'put',
            data: courseInfo
        })
    },
    // 根据ID获取课程信息
    getCoursePublishVoById(id){
        return request({
            url: `${api_name}/getCoursePublishVoById/${id}`,
            method: 'get'
        })
    },
    // 课程发布
    publishCourse(id) {
        return request({
          url: `${api_name}/publishCourse/${id}`,
          method: 'put'
        })
      },
    // 课程分页查询
    getPageList(page, limit, searchObj) {
    return request({
        url: `${api_name}/${page}/${limit}`,
        method: 'get',
        params: searchObj
    })
    },
    // 根据ID删除课程
    removeById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    }
}